home *** CD-ROM | disk | FTP | other *** search
/ World of Education / World of Education.iso / world_s / sm20a.zip / SYMBMATH.DOC < prev    next >
Text File  |  1992-04-16  |  39KB  |  1,017 lines

  1.         SymbMath 2.0: A Symbolic Calculator with Learning
  2.                 (Version 2.0)
  3.  
  4.         Copyright (C) 1990-1992
  5.  
  6.         by Dr. Weiguang HUANG
  7.     5/6 Cara Road, Geelong, Vic. 3216, Australia
  8.         Phone: (052)443282
  9.  
  10.  
  11.         This is Part One of manual. Please read Part Two in the file
  12. SymbMath.DO2.
  13.         This manual is uncompleted at the moment (April 15, 1992) as 
  14. SymbMath is growing. Welcome to report any error or suggestion
  15. in this manual to the author.
  16.  
  17.  
  18.             Contents
  19.  
  20. 1. Introduction
  21. 2. Capabilities
  22. 3. A List of Files in SymbMath Package
  23. 4. Pull-down Menu and Pop-up Menu
  24.     4.1 File Menu
  25.     4.2 Edit Menu
  26.     4.3 Run Menu
  27.     4.4 Output Menu
  28.     4.5 Color Menu
  29.     4.6 Help Menu
  30.         4.7 Print Menu
  31.         4.8 Edit Help Menu
  32. 5. Programming in SymbMath
  33. 6. Data Types
  34.         6.1 Numbers
  35.         6.2 Constants and Built-in Constants
  36.         6.3 Variables and Built-in Variables
  37.         6.4 Functions
  38.                 6.4.1 Built-in Standard Functions
  39.                 6.4.2 Calculus and Transformation Functions
  40.                 6.4.3 User-defined Functions
  41.         6.5 Equations
  42.         6.6 Lists, Arrays, Vectors and Matrices
  43.         6.7 List Index
  44. 7. Operators
  45. 8. Expressions
  46. 9. Statements
  47.         9.1 Comment Statement
  48.         9.2 Evaluation Statement
  49.         9.3 Assignment Statement
  50.         9.4 Switch Statement
  51.         9.5 Command Statement
  52.         9.6 Compound Statement
  53.         9.7 End Statement
  54. 13. Library
  55. 15. Examples
  56.     15.1 Declaration and Simplification
  57.     15.2 Calculation
  58.     15.3 User-defined Function and Evaluation
  59.     15.4 Limits
  60.     15.5 Differentiation
  61.     15.6 Integration
  62.     15.7 Algebraic Equations
  63.     15.8 Differential and Integral Equations
  64.     15.9 Sums and Products
  65.     15.10 Series
  66.     15.11 Lists, Arrays, Vectors and Matrices
  67.     15.12 Complex Analysis
  68.     15.13 Tables of Function Values
  69.     15.14 Transformation and Pieces of Expressions
  70.     15.15 Chemical Calculation
  71.     15.16 Chemical Reactions
  72.         15.17 Learning from Users
  73.                 15.17.1 Learning complicated indefinite integrals
  74.                         from a simple indefinite integral
  75.                 15.17.2 Learning definite integral from indefinite integral
  76.                 15.17.3 Learning integral from derivative
  77.                 15.17.4 Learning integral from algebra
  78.                 15.17.5 Learning complicated derivatives from a simple
  79.                         derivative
  80.                 15.17.6 Learning complicated algebra from simple algebra
  81. 16. Interface with Other Software
  82.         16.1 With PlotData for Graph
  83. 17. Inside SymbMath
  84. 18. System Limits
  85. 19. Future
  86. 20. Keywords
  87.     20.1 Keywords in Alphabetical Order
  88.     20.2 Keywords in Functional Order
  89.         20.3 Keywords Dictionary
  90. 21. References
  91.  
  92.  
  93.         1.     Introduction
  94.  
  95.         SymbMath (an abbreviation for Symbolic Mathematics) is not
  96. only a symbolic calculator but also an expert system that can solve 
  97. symbolical math problems. SymbMath will also perform exact numeric 
  98. computation. It can manipulate complicated formulas and return answers 
  99. in terms of symbols, formulas and exact numbers. 
  100.     SymbMath is different from other software. 
  101.         (1) It is able to learn from users.  If users only input one 
  102.         formula (e.g. one derivative) without writing any code, 
  103.             it will automatically learn many problems (e.g. 
  104.         derivatives, indefinite and definite integrals) related 
  105.         to this formula.
  106.         (2) Users can easily edit the library (e.g. integral tables)
  107.             in "formula format". 
  108.         (3) It requires only 640 KBytes RAM, so it can run on small
  109.             IBM PCs under MS-DOS. 
  110.  
  111.  
  112.                   2.     Capabilities
  113.  
  114.         Its capabilities include facilities to provide analytical and 
  115. numerical answers for:
  116.          o  Differentiation: regular or higher order, partial or
  117.             total, mixed and even implicit differentiation,
  118.         one-sided derivatives.
  119.          o  Integration: indefinite or definite integration, 
  120.             multiple integration, infinity as a bound, parametric
  121.             integration, iterated integration, line or surface 
  122.             integrals, discontinuous or implicit integration.
  123.          o  Solution of equations: roots of a polynomial, systems of
  124.             algebraic or differential equations.
  125.          o  Manipulation of expressions: simplification,
  126.             factoring or expansion, substitution, evaluation,
  127.             user-defined functions, built-in standard functions,
  128.         over 80 internal functions.
  129.          o  Calculation: exact and floating-point numerical 
  130.             computation of integer, rational, real and complex
  131.             numbers in the range from minus to plus infinity, even
  132.             with different units.
  133.          o  Limits: real or complex limits, one-sided limits, 
  134.             indeterminate forms.
  135.      o  Complex: calculation, functions, derivatives, integration.
  136.      o  Sum and product: finite or infinite, partial.
  137.          o  Chemical calculation: molecular and atomic weights,
  138.             concentrations (all by entering the symbols of the
  139.             chemical elements).
  140.          o  Chemical reactions: inorganic and organic. 
  141.          o  Other: series, lists, arrays, vectors, matrices, etc.
  142.     Also included are:
  143.          o  Pull-down and pop-up menus, sizable and colourable windows.
  144.          o  Twin screen text editor with syntax check.
  145.          o  Programming in integrated edit-interpret-debug environment.
  146.          o  Reading and generating BASIC and FORTRAN codes.
  147.          o  Displaying two-dimensional math notation.
  148.          o  On-line help, and on-line manual.
  149.          o  Interface with other software (e.g. with PlotData for graph).
  150.     Its shareware version (SM20A.ZIP) is available free from the
  151. Calculator directory in SIMTEL20 archives on many anonymous FTP sites
  152. (wsmr-simtel20.army.mil, rana.cc.deakin.oz.au, garbo.uwasa.fi, etc) or
  153. by e-mail from listserv@vm1.nodak.edu, listserv@ndsuvm1.bitnet.
  154.         SymbMath is growing though it has limited features at the
  155. moment.
  156.  
  157.  
  158.                 3. A List of Files in SymbMath Package
  159.  
  160. -------------------------------------------------------------------------
  161. SymbMath.exe    executable SymbMath system.
  162. SymbMath.ini    initial file.
  163. SymbMath.sys    configuration file.
  164. SymbMath.hlp    help file, how to use help.
  165. SymbMath.hl2    help file, the list of the edit commands.
  166. SymbMath.hl3    help file, the list of keywords.
  167. SymbMath.hl4    help file, the keywords dictionary.
  168. SymbMath.txt    introduction of SymbMath.
  169. SymbMath.doc    part one of document file or manual file.
  170. SymbMath.do2    part two of document file or manual file.
  171. readme          read me file, the latest updates and suggestion about
  172.                 SymbMath.
  173. *.li            library files.
  174. *.sm            user program files.
  175. problem.txt     problems that other software cannot solved, but
  176.                 SymbMath can do.
  177. comment*.txt    comments on SymbMath.
  178. statis.txt     the download statistics at FTP site of garbo.uwasa.fi.
  179. exerci*.*       exercise from the textbook.
  180. prolog.err      error messages.
  181. shareware.txt   shareware concept.
  182. software.txt    software available from the author Dr. W.Huang.
  183. prolog.log      log file of SymbMath.
  184. ------------------------------------------------------------------------
  185.  
  186.     SymbMath has three versions: Shareware, Student and Advanced
  187. versions. 
  188.  
  189.  
  190.         4. Pull-down Menu and Pop-up Menu
  191.  
  192.     The screen is divided into four areas: menu line, edit window,
  193. output window, and status line.
  194.         The menu line has 6 pull-down menus:
  195.  
  196. ------------------------------------------------------
  197. | File   Edit    Run     Output     Color    Help |
  198. ------------------------------------------------------
  199.  
  200. and 2 pop-up menus: print and edit help.
  201.     Select the menu by the arrow keys or the first capital letter.
  202.  
  203.  
  204.         4.1 File Menu
  205.  
  206.         The File menu has 6 choices in the pull-down menu:
  207.  
  208. -----------
  209. |Load     |
  210. |New File |
  211. |Save     |
  212. |Directory|
  213. |OS shell |
  214. |Quit     |
  215. -----------
  216.  
  217.         The "Load" command loads a file from a disk into the editor.
  218.         The "New file" command creates a new file.
  219.         The "Save" command saves the program in the editor into a disk.
  220.         The "Directory" command changes the current directory.
  221.         The "OS shell" command executes a DOS command and automatically
  222. returns to the SymbMath system if users provide a special DOS command on
  223. the command window, otherwise it goes to the DOS shell, control must be 
  224. returned to the resident SymbMath system with the EXIT command on the 
  225. DOS shell.
  226.         The "Quit" command exit from SymbMath.
  227.  
  228.  
  229.         4.2 Edit Menu
  230.  
  231.          SymbMath includes twin screen text editor for creating and
  232. modifying program files.  Usage of the editor is similar to WordStar
  233. in nondocument mode, or to Borland's SideKick, or editor in C
  234. compiler. The problem files are ordinary ASCII files, and can be
  235. edited with any other text editor.
  236.         Within the Edit window, press <F1> to pop-up the Edit Help 
  237. menu (see 4.7 Edit Help Menu), or <Shift><F1> to call the manual.
  238.         As the twin screen editor, use <F8> to call an auxiliary
  239. editor in another window, and <F7> to copy block from the auxiliary
  240. editor into the main editor.
  241.         You can move the cursor around in the editor with the arrow
  242. keys, <Page Up>, <Page Down>, and some other keys listed below.  The
  243. editor has two typing modes, Insert and Overwrite.  In Insert
  244. mode, anything you type is inserted at the cursor position.  In
  245. Overwrite mode, pressing a key replaces the current character
  246. at the cursor position with the new typed character.  Initially,
  247. the editor operates in Insert mode, to switch modes, press the
  248. <Insert> key or <Ctrl>V.  (<Ctrl>V means to hold down the <Ctrl> key
  249. on your keyboard while you press V.  The V need not be in upper
  250. case.)
  251.         Unlike a more standard word processing program, the editor
  252. does not have word-wrap. You must press <Enter> at the end of each
  253. line.
  254.         The editor has an autoindent feature that allows subsequent
  255. lines to automatically indent.  If you leave several spaces at the
  256. start of a line, use <Ctrl>OI to indent subsequent lines the same
  257. amount.  The command sequence is a toggle, so you need only
  258. press <Ctrl>OI again to stop indenting.
  259.         Sometimes you may want to see more than the area covered by
  260. the current window.  You can "zoom" the window, expanding it to the
  261. size of the entire screen, by pressing <F5>.  To return the window
  262. to its usual size, press <F5> again.  For other window commands,
  263. such as moving and resizing a window, see the Window menu, below.
  264.         Text in the editor always be saved after exit by press <Esc>.
  265.  
  266.           Table 4.2  Summary of the editing commands.
  267. ---------------------------------------------------------------
  268.            Cursor Movement Commands (move cursor to):
  269.  
  270.   Character left         <Ctrl>S or Left arrow <-
  271.   Character right        <Ctrl>D or Right arrow  ->
  272.   Word left              <Ctrl>A or <Ctrl> <-
  273.   Word right             <Ctrl>F or <Ctrl> ->
  274.   Line up                <Ctrl>E or Up arrow
  275.   Line down              <Ctrl>X or Down arrow
  276.   Scroll up              <Ctrl>W
  277.   Scroll down            <Ctrl>Z
  278.   Page up                <Ctrl>R or <Pg Up>
  279.   Page down              <Ctrl>C or <Pg Dn>
  280.   Beginning of line      <Ctrl>QS or <Home>
  281.   End of line            <Ctrl>QD or <End>
  282.   Top of screen          <Ctrl>QE or <Ctrl><Home>
  283.   Bottom of screen       <Ctrl>QX or <Ctrl><End>
  284.   Top of file            <Ctrl>QR or <Ctrl><Pg Up>
  285.   Bottom of file         <Ctrl>QC or <Ctrl><Pg Dn>
  286.   Beginning of block     <Ctrl>QB
  287.   End of block           <Ctrl>QK
  288.   Previous point         <Ctrl>QP
  289.   Marker 0               <Ctrl>Q0
  290.   Marker 1               <Ctrl>Q1
  291.   Marker 2               <Ctrl>Q2
  292.   Marker 3               <Ctrl>Q3
  293.   Set marker 0           <Ctrl>K0
  294.   Set marker 1           <Ctrl>K1
  295.   Set marker 2           <Ctrl>K2
  296.   Set marker 3           <Ctrl>K3
  297.  
  298.   Insert & Delete Commands:
  299.  
  300.   Insert mode on/off                 <Ctrl>V or <Ins>
  301.   Insert line                        <Ctrl>N
  302.   Delete line                        <Ctrl>Y
  303.   Delete to end of line              <Ctrl>QY
  304.   Delete left character              <Ctrl>H or <Backspace>
  305.   Delete character under cursor      <Ctrl>G or <Del>
  306.   Delete right word                  <Ctrl>T
  307.  
  308.   Block commands:
  309.  
  310.   Mark block begin       <Ctrl>KB
  311.   Mark block end         <Ctrl>KK
  312.   Mark word              <Ctrl>KT
  313.   Hide block             <Ctrl>KH
  314.   Copy block             <Ctrl>KC or <F5>
  315.   Repeat the last copy   <Shift><F5>
  316.   Move block             <Ctrl>KV or <F6>
  317.   Delete block           <Ctrl>KY
  318.   Read block             <Ctrl>KR or <F7>
  319.   Write block            <Ctrl>KW
  320.   Print block            <Ctrl>KP
  321.  
  322.   Miscellaneous Commands:
  323.  
  324.   Quit edit                     <Esc>, <F10>, <Ctrl>KD, or <Ctrl>KQ
  325.   Call the auxiliary editor     <F8>
  326.   Tab                           <Ctrl>I or <Tab>
  327.   Tab mode toggle               <Ctrl>OT
  328.   Auto indent on/off            <Ctrl>OI
  329.   Restore line                  <Ctrl>QL
  330.   Find                          <Ctrl>QF or <Ctrl><F3>
  331.   Repeat last find              <Ctrl>L or <Shift><F3>
  332.   Find & replace                <Ctrl>QA or <Ctrl><F4>
  333.   Repeat last find & replace    <Ctrl>L or <Shift><F4>
  334.   Control key prefix            <Ctrl>P
  335.   Abort operation               <Ctrl>U
  336.   Restore error message         <Ctrl>QW
  337.  
  338.   Search Options:
  339.  
  340.   L           Local search
  341.   G           Global search
  342.   N           Replace without asking
  343.   Y           Replace with asking
  344. ------------------------------------------------------------------
  345.  
  346.  
  347.                         4.3 Run Menu
  348.  
  349.         The Run menu interprets the user program in the main editor,
  350. runs it into memory, and outputs the results in the output window.
  351.  
  352.  
  353.         4.4 Output Menu
  354.  
  355.         The Output menu has 3 choices:
  356.  
  357. __________
  358. |To disk |
  359. |Off disk|
  360. |Window  |
  361. ----------
  362.  
  363.         The "To disk" command forces the output to a disk file.
  364.         The "Off disk" command returns the output control from the
  365. disk file to the output window.
  366.         The "Window" command changes the output window size.
  367.  
  368.         SymbMath can write output to screen, a disk and a printer.
  369.         Users select the "To disk" command in the Output window to
  370. force output to a disk file, and select the "Off disk" command to
  371. return the output into the Output window (screen). These output in
  372. the disk file can be read back into SymbMath by selecting the command
  373. "Load" in the File menu, but only the output in BASIC format can be
  374. run. Therefore, use the BASIC output format by setting the switch
  375. Output=BASIC when you write the output into a disk file.
  376.         A reserved word "last" is the last output.
  377.  
  378.  
  379.         4.5 Color Menu
  380.  
  381.     The Color menus has 4 choices in the pull-down menu:
  382.  
  383. ---------------
  384. |Menu line    |
  385. |Edit window  |
  386. |Output window|
  387. |Status line  |
  388. ---------------
  389.  
  390.     When users choose one of them, the color pattern will come up.
  391. Users select the favor color by the arrow keys and <Enter>.
  392.  
  393.  
  394.                 4.6 Help Menu
  395.  
  396.         The Help menu has 4 choices in the pull-down menu:
  397.  
  398. -------------
  399. |How to help|
  400. |Editor     |
  401. |Keywords   |
  402. |Dictionary |
  403. -------------
  404.  
  405.         Each has its own help window and help file. The on-line help
  406. files are text (ASCII) files.
  407.         In the help window, to search for a special word, you first
  408. press <Ctrl><F3>, then type the word you want to search, finally
  409. press <Ctrl><F3> again. e.g. if you want to search for the word
  410. "help", you first press <Ctrl><F3>, then type "help", finally
  411. press <Ctrl><F3> again. The cursor will go to the word "help".
  412. You press <Shift><F3> to repeat the last find.
  413.         The commands within the help window are the same as that
  414. within the edit window, except that text is unable to be changed.
  415.  
  416.  
  417.         Table 4.5        Commands Within the Help window
  418. -------------------------------------------------------------------
  419. Commands    Action
  420.  
  421. arrows keys     move the cursor.
  422. <F5>            zoom the window, <F5> again to zoom out.
  423. <Esc>           exit from the window.
  424. <F10>           exit from the window, the same as <Esc>.
  425. <PgUp>          page up.
  426. <PgDn>          page down.
  427. <F2>            go to nth line, end by <F2> instead of <Enter>.
  428. <Ctrl><F3>      find the special word, end by <Ctrl><F3>
  429.                 instead of <Enter>.
  430. <Shift><F3>     repeat last find.
  431. <Shift><F10>    re-size window by arrow keys.
  432. ----------------------------------------------------------------------
  433.  
  434.         There are other two help windows in the Edit window, press 
  435. <F1> to pop-up the Edit Help Menu, or <Shift><F1> to call the manual
  436. window.
  437.  
  438.  
  439.             4.7 Print Menu
  440.  
  441.         Users pop-up the Print Menu by <Alt>P, and set "Printer On" in
  442. the Print window to toggles echoing to a printer, or/and set "Log File
  443. On" to toggles echoing to the log file "Prolog.Log".
  444.     Another way to print, by using MS-DOS screen print command 
  445. <Print Screen>, everything on screen is printed out.
  446.  
  447.  
  448.                        4.8 Edit Help Menu
  449.  
  450.        Users pop-up the Edit Help menu by pressing <F1> within the
  451. editor.
  452.         This menu has 7 choices:
  453.  
  454. ------------------
  455. |Show help file  |
  456. |Cursor movement |
  457. |Insert & Delete |
  458. |Block functions |
  459. |Wordstar-like   |
  460. |Miscellaneous   |
  461. |Global functions|
  462. ------------------
  463.  
  464. Except for the first choice of the show help file, others have their own
  465. sub-menu. Users can select the edit command from the sub-menu.
  466.  
  467.  
  468.                     5. Programming in SymbMath
  469.  
  470.         SymbMath is an interpreter, and accepts a program from the
  471. SymbMath Editor or a disk. It runs the program written by any editor
  472. in the text (ASCII) file format. After the first program was run into
  473. memory, users can call any part of the first program from a second
  474. program, as it seems the part of the first program has already been in
  475. the second program. Users can run many programs into SymbMath at a time.
  476. However, all names of the variables are public and name conflicts
  477. must be avoided.
  478.         Users can clear all of them from memory by the command
  479. "clear_all". Note that the switch library "Switch.Li" should be run
  480. after clearing all from memory by "clear_all", otherwise the default
  481. switches may be changed.
  482.         SymbMath language is procedure language, which is executed
  483. from top to bottom in a program, like BASIC, FORTRAN, or PACSAL.
  484. It also is an expression-oriented language. SymbMath program
  485. consists of a number of statements. The most useful statement
  486. contains expressions, the expression includes data, and the most
  487. important data is functions.
  488.         The structure of SymbMath language is:
  489.                 data -> expression -> statement -> program
  490.         Note that upper and lower case letters are different in 
  491. SymbMath language, e.g. abc is different from ABC.
  492.  
  493.  
  494.                         6. Data Types
  495.  
  496.         Data in SymbMath language is the numbers, constants, variables,
  497. functions, equations, lists, arrays, vectors, matrixes, and list index.
  498. All data can be operated.
  499.  
  500.                         6.1 Numbers
  501.     The types of numbers are integer, rational, floating-point, 
  502. power, real and complex numbers in the range from -infinity to 
  503. infinity. 
  504.     In fact, the range of the input real numbers is 
  505. -inf, -(10^307)^(10^307) to -(10^-307)^(10^-307), 0, (10^-307)^(10^-307)
  506.  to (10^307)^(10^307), inf.
  507.     The range of the output real numbers is the same as input 
  508. when the switch Numerical=Off, but when the switch Numerical=On, it is
  509.     -inf, -1.E307 to -1.E-307, 0, 1.E-307 to 1.E307, inf.
  510.     It means that the number larger than 1.e307 is converted 
  511. automatically to inf, the absolute values of the number less than 
  512. 1.e-307 is converted to 0, and the number less than -1e307 is 
  513. converted to -inf.
  514.  
  515.     For examples:
  516. -------------------------------------------
  517. Numbers        Type
  518.  
  519. 23        integer
  520. 2/3        rational
  521. 0.23        floating-point
  522. 2.3E2        floating-point
  523. 2.3e-2        floating-point
  524. 2.3*10^20    power
  525. 10^1.E200    power
  526. 2+3*i        complex
  527. inf        real
  528. inf+i        complex
  529. 3.14+inf*i    complex
  530. inf+inf*i    complex
  531. ---------------------------------------------
  532.  
  533.     The real numbers include the integer, rational, floating-
  534. point, and power numbers. They may be different when the switch 
  535. Numerical=Off, and are the same when the switch Numerical=On (i.e. 
  536. all converted to the floating-point numbers). That "a" and "b" are 
  537. the same means a-b = 0, while that they are different means a-b<>0. 
  538. For the floating-point numbers, the upper and lower case letters E 
  539. and e are the same, e.g. 1e2 is the same as 1E2.
  540.  
  541.  
  542.                 6.2. Constants and Built-in Constants
  543.  
  544.     Constants are the unchangable values. There are some built-in 
  545. constants. The name of these built-in constants should be avoided in 
  546. the user-defined constants.
  547.  
  548. ------------------------------------------------------------------
  549. Built-in Constants    Meanings
  550.  
  551. pi=3.1415926536        the circular constant.
  552. e=2.7182818285        the base of the natural logarithms.
  553.       1/2
  554. i=(-1)
  555. inf            infinity.
  556. -inf             negative infinity.
  557. constant                the integral constant
  558. discont                 discontinuity, e.g. 1/0. Evaluate the one-
  559.             sided value by x=c+zero or c-zero if the 
  560.             value of expr is discont.
  561. c-zero                  approach c from negative (-inf) direction,
  562.                         limit as zero ->0.
  563. c+zero                  approach c from positive (+inf) direction,
  564.                         limit as zero ->0.
  565. undefined               the undefined value, e.g. indetermiate forms:
  566.             0/0, inf/inf, 0*inf, 0^0, etc.
  567. --------------------------------------------------------------------
  568.  
  569.         Notice that the constants discont and undefined are
  570. different. If the value of an expression at x=c is discont, the
  571. expression only has the one-sided value at x=c and this one-sided 
  572. value is evaluated by x=c+zero or x=c-zero. If the value of an 
  573. expression at x=c is undefined, the expression may be evaluated by 
  574. the function lim(). 
  575.  
  576.         e.g. evaluate 1/sgn(x) and sin(x)/x at x=0.
  577.         Input:
  578. define(f(x)=1/sgn(x))
  579. f(0)
  580. f(0+zero)
  581.         Output:
  582. defined
  583. discont
  584. 1
  585.  
  586.         Input:
  587. f2=sin(x)/x
  588. subs(x=0, f2)
  589. lim(x=0, f2)
  590.         Output:
  591. f2 = sin(x)/x
  592. undefined
  593. 1
  594.  
  595.  
  596.                 6.3. Variables and Built-in Variables
  597.  
  598.     The sequence of characters is used as the name of variables. 
  599. The usual used independent variable is "x". A value can be assigned
  600. to the variable, by (1) the assignment "=", (2) the user-defined
  601. function f(), (3) the function subs(). e.g. (1) x=2, (2) f(2) if
  602. f(x)=x^2 has been defined, (3) subs(x=2 to x^2).
  603.         The built-in variable is "last". The variable "last" is
  604. always be assigned the value of the last output.
  605.  
  606.  
  607.                 6.4. Functions
  608.                 6.4.1 Built-in Standard Functions
  609.  
  610.          Different versions of SymbMath have different built-in 
  611. standard functions. The Advanced Version C has all of them. See 
  612. the following table in detail for other versions. All below standard
  613. functions except n! or fac(n) can be differentiated and integrated
  614. symbolically.
  615.  
  616.                 Table 6.1        Built-in Standard Functions
  617. -----------------------------------------------------------------------
  618. Functions    Meanings
  619.  
  620. n!        factorial of n.
  621. fac(n)        the same as n!.
  622. sqrt(x)        square root, the same as x^0.5.
  623. exp(x)         the same as e^x.
  624. sgn(x)          1 when Re(x) > 0, or Re(x) = 0 and Im(x) > 0; 0 when
  625.                 x=0; -1 otherwise.
  626. abs(x)        absolute value of x.
  627.  
  628. ............... above functions in Shareware Version A ...............
  629.  
  630. ln(x)           natural logarithmic function of x, based on e.
  631.  
  632. sin(x)          sine function of x.
  633. cos(x) 
  634. tan(x) 
  635. csc(x) 
  636. sec(x) 
  637. cot(x) 
  638. asin(x)         arc sine function of x, the inverse of sin(x).
  639. acos(x) 
  640. atan(x)
  641. acot(x)
  642. asec(x)
  643. acsc(x)
  644.  
  645. ............... above functions in Student Version B .................
  646.  
  647. sinh(x)         hyerbolic sine function of x.
  648. cosh(x) 
  649. tanh(x) 
  650. csch(x) 
  651. sech(x) 
  652. coth(x)
  653. asinh(x)        arc hyerbolic sine function of x, the inverse of sinh(x).
  654. acosh(x) 
  655. atanh(x)
  656. acoth(x)
  657. asech(x)
  658. acsch(x)
  659.  
  660. erf(x)          error function, or probability integral function of x.
  661. --------------------------------------------------------------------------
  662.  
  663.  
  664.                 6.4.2 Calculus and Transformation Functions
  665.  
  666.         Calculus functions are for calculus calculation while trans-
  667. formations functions are to move or take a piece of expression.
  668.  
  669.                 Table 6.2       Calculus Functions
  670. ----------------------------------------------------------------------
  671. Functions    Meanings
  672.  
  673. subs(x=c, y)    substitutes x by c in y.
  674. subs(x=c to y)    the same as subs(x=c,y).
  675. lim(x=c, y)    gives the limit of y when x approaches c. Note that 
  676.         the correct answers only for the indeterminate forms:
  677.                 0/0, inf/inf, 0*inf, 0^0, inf^0.
  678. d(y, x=c)    gives the derivative of y with respect to an undefined
  679.         variable x at x=c.
  680. d(y, x=c, n)    gives the nth order derivative of y with respect to an 
  681.         undefined variable x at x=c.
  682. d((y)/d(x))    differentiate y with respect to x.
  683. d((y)/d(x)), n)    gives the nth order derivative of y with respect to an 
  684.         undefined variable x.
  685. d(y)        implicit differentiation, used in differential equations, 
  686.         e.g. x*d(x)+y*d(y) == 0.
  687. inte(y,x,a,b)    find the definite integral of y with respect to an 
  688.         undefined variable x taken from x=a to x=b.
  689. inte(y, x from a to b)  the same as inte(y,x,a,b).
  690. inte((y)*d(x))    find the indefinite integral of y with respect to an
  691.         undefined variable x.
  692. inte(y)        implicit integration, used to integrate the differential
  693.         equations
  694. sum(y, x from a to b step c)    sum of y.
  695. sum(y, x from a to b)        sum of y step=1.
  696. sum([y])            transform list to sum
  697. prod(y, x from a to b step c)    product of y.
  698. prod(y, x from a to b)        product of y step=1.
  699. ---------------------------------------------------------------------
  700.  
  701.  
  702.                 Table 6.3      Transformation Functions
  703. ---------------------------------------------------------------------
  704. expand(F)       expand F, e.g. expand((a+b)^2) gives a^2 + 2*a*b + b^2.
  705. factor(F)       factorise from F, e.g. factor(a^2 + 2*a*b + b^2) gives
  706.                 (a+b)^2.
  707. solve(F==0, x)    solve polynomial equation, systems of linear equations,
  708.         linear differential equations.
  709. list(y, x from a to b step c)    lists of y
  710. list(y)                transform sum to list
  711. table(y, x from a to b step c)    data table
  712. coef(expr, x^n)            gives the coefficient of x^n in expr.
  713. assume(x>0)                     assume x>0.
  714. assume(x<0)                     assume x<0.
  715. assume(x == real)               assume x is real.
  716. left(eq)                        left hand side of an equation.
  717. right(eq)                       right hand side of an equation.
  718. re(x)                           real part of complex numbers.
  719. im(x)                           imaginative part of complex numbers.
  720. nume(a/b)                       numerator of division, i.e. a.
  721. deno(a/b)                       denominator of a/b, i.e. b.
  722. -----------------------------------------------------------------------
  723.  
  724.  
  725.     For example:
  726. ---------------------------------------------------------
  727. differentiation    diff()        d((x^2)/d(x))        
  728. integration    inte()        inte((x^2)*d(x))    
  729. limit        lim()        lim(x=0, sin(x)/x)    
  730. solving        solve()        solve(x^2+1==0, x)    
  731. expanding    expand()    expand((a+b)^2)        
  732. factoring    factor()    factor(a*c+b*c)        
  733. -----------------------------------------------------------
  734. where "x" is an undefined variable.
  735.  
  736.     Above functions can be operated and chained, like the standard 
  737. functions. 
  738.     If the undefined variable d(x) is omitted in the functions d(y) 
  739. and inte(y), they are implicit derivatives and integrals. If f(x) is 
  740. undefined, d(f(x)/d(x)) is differentiation of f(x). These are useful in 
  741. the differential and integral equations. (see later chapters).
  742.     For examples:
  743.     inte(inte(F * d(x)) * d(y)) is double integral with respect 
  744. to both variables x and y. 
  745.     d(d(y/d(x)) x=c) is the second order derivative of y with 
  746. respect to x at x=c.
  747.     d(d(y/d(x))/ d(t)) is the mixed derivative of y with respect 
  748. to x and t.
  749.     d((y)/d(x)) is different from d(y)/d(x): (1) d((y)/d(x)) is 
  750. an operation of differentiation, while d(y)/d(x) is not; (2) y and d(x)
  751. is inside the same () in d((y)/d(x)), while d(y) and d(x) can be 
  752. separated in d(y)/d(x). d(y)/d(x) is the same as y', d(x) can be 
  753. operated.
  754.         The keywords "from" "to" "step" "," are the same as separators
  755. in multi-arguement functions. e.g. inte(f(x), x, 0, 1) are the same as
  756. inte(f(x), x from 0 to 1).
  757.         The Shareware Version has not solve(), while the Student
  758. Version and the Advanced Version have all of these functions.
  759.  
  760.  
  761.                 6.4.3 Users-defined Functions
  762.  
  763.         Users can define the new functions, which include the
  764. standard functions, calculus functions, and algebraic operators.
  765.     Users define a new function f(x) by define(), 
  766.  
  767.         define(f(x)=x^2)
  768.  
  769. and then call f(x) as the standard functions. The function name can 
  770. be any name, except for the keywords. The maximum number of arguments 
  771. in the users-defined functions on this version is 2, e.g. f(x) and 
  772. f(x,y).
  773.         Alternately, users assign x^2 to a variable f by f=x^2, and 
  774. then call the variable f by subs(x=c to f). f=x^2 seems a function.
  775.         To clears a variable or function from memory by
  776.  
  777.                 clear(x)          clear x from memory.
  778.                 clear(f(x))       clear f(x) from memory.
  779.                 clear_all         clear all from memory.
  780.  
  781.         Note that the switch library "Switch.Li" should be run after
  782. clearing all from memory by "clear_all", otherwise the default switches
  783. may be changed.
  784.  
  785.  
  786.                 6.5 Equations
  787.  
  788.         An equation is an equality of two sides linked by an equation
  789. sign "==", e.g. x^2+p == 0, where the symbol "==" stands for an
  790. equation. Note the symbols "==" and "=" are different. Systems of
  791. equations are a list of equations, e.g. [a1*x+a2*y==a3, b1*x+b2*y==b3].
  792.  
  793.  
  794.                 6.6 Lists, Array, Vectors and Matrices
  795.  
  796.         A list is [a, b, c].
  797.         An array is a list of lists. e.g. [a, b, [c1, c2]].
  798.         A vector and matrix are similar a list and array, but in a
  799. matrix, the number of elements in each row should be the same, e.g.
  800. [[a11, a12], [a21, a22]].
  801.  
  802.  
  803.                 6.7 List Index and Built-in List Index
  804.  
  805.         The list index is the index for n-th element in a list. e.g.
  806. b[2] indicates the second element in the list b.
  807.         The built-in list index is last[number]. The name of last 
  808. output list is "last", e.g. last[1] is the first element in the
  809. last output list.
  810.  
  811.  
  812.                         7. Operators
  813.  
  814.         Table 7.1       Operators
  815. -----------------------------------------------------------------
  816. Operation               Operators       Examples        Order
  817.  
  818. comma                   ,               a=2, b=3        1
  819. assignment              =               p=2+b           2
  820. equation                ==              x^2+x+1==0      3
  821. equal                   ==              a==2            3
  822. larger than             >               a>2             3
  823. larger and equal        >=              a>=2            3
  824. less than               <               a<2             3
  825. less and equal          <=              a<=2            3
  826. unequal                 <>              a<>2            3
  827. plus                    +               a+b             4
  828. minus                   -               a-b             4
  829. mutilation              *               a*b             5
  830. division                /               a/b             5
  831. power                   ^               a^b             6
  832. power                   **              a**b            6
  833. factorial               !               n!              6
  834. positive                +               +a              7
  835. negative                -               -a              7
  836. function                f()             sin(x)          7
  837. list index              f[]             f[1]            7
  838. parentheses             ()              (a+b)*c         7
  839. list                    []              [a,b]           7
  840. --------------------------------------------------------------------
  841.  
  842.     All functions have the same 7th order.
  843.         Operations with higher order precede, otherwise operations are
  844. performed left to right.  These are the usual algebraic conventions.
  845.     a^b^c is the same as (a^b)^c.
  846.  
  847.  
  848.                         8. Expressions
  849.  
  850.         An expression (i.e. expr) is combination of data and operators.
  851. e.g. a+b-f(c).
  852.  
  853.  
  854.                         9. Statements
  855.  
  856.         The statements include:
  857.                 comment statement
  858.                 evaluation statement
  859.                 assignment statement
  860.                 switch statement
  861.                 command statement
  862.                 compound statement
  863.                 end statement
  864. SymbMath program must be terminated by the end statement.
  865.  
  866.  
  867.                         9.1 Comment Statement
  868.  
  869.         # is the comment statement sign.
  870.         You can add comments into a line, or even produce a single line
  871.   which is entirely a comment, by preceding the comment sign with #.
  872.   For example:
  873.                # This is my program
  874.                3 + 4    # My first calculation
  875.  
  876.   Comments make your calculations more understandable, whether you
  877.   are making a printed record of what you are doing or if you just
  878.   want to jot some notes to yourself while you are working.
  879.  
  880.  
  881.                 9.2 Evaluation Statement
  882.  
  883.         The evaluation statement has the format:
  884.  
  885.                 expression
  886.  
  887.         SymbMath evaluates any expression which in a line and gives
  888. the value of the expression. e.g.
  889.         Input:
  890.         3 + 4
  891.         Output:
  892.         7        # the value of 3+4
  893.         Input:
  894.         d(x^6/d(x))
  895.         Output:
  896.         6 x^5       # the value of d(x^6/d(x))
  897.  
  898.         The last output can be saved to a variable for the later use
  899. by the built-in variable "last", e.g. f=last.
  900.  
  901.  
  902.                  9.3 Assignment Statement
  903.  
  904.         The assignment statement specifies that a new value of
  905. expression_2 be assigned to expression_1, and saved into memory. The
  906. form of an assignment is
  907.  
  908.                 expression_1 = expression_2
  909.  
  910. where "=" is the assignment operator.
  911.         Note that not only a single variable but also an expression
  912. can be assigned. e.g. x=2, sin(x)/cos(x)=tan(x).
  913.         e.g. evaluate of d() and assign the result (6*x^5) to f.
  914.         f=d(x^6/d(x))
  915.  
  916.  
  917.               9.4 Switch Statement
  918.  
  919.         The switch statement sets or changes the switch status. The
  920. switch status is unchanged in memory until the new switch status is
  921. assigned.
  922.  
  923. ----------------------------------------------------------------------
  924. Switch            Action
  925.  
  926. Numerical=On        convert numbers to floating-point numbers.
  927. Numerical=Off        not convert numbers to floating-point numbers, 
  928.             this is default.
  929. NumIntegrate=Off        disable numerically integration, this is default.
  930. NumIntegrate=On         numerically integration.
  931. Output=TwoDim        display output in two dimension, this is default.
  932. Output=BASIC            display output in BASIC format.
  933. Output=FORTRAN          display output in FORTRAN format.
  934. Output=Off        not display output.
  935. ExpExpand=On            exponent expansion. e.g. c^(a+b) to c^a*c^b.
  936. ExpExpand=Off           disable exponent expansion, this is default.
  937. LnExpand=On             log expand, e.g. ln(a*b) to ln(a)+ln(b)
  938. LnExpand=Off            disable log expansion, this is default.
  939. ----------------------------------------------------------------------
  940.  
  941.         Remember that first letter of the switch is upper case, and
  942. first letter of words are upper case, too. e.g. TwoDim means two
  943. dimension.
  944.  
  945.  
  946.                 9.5 Command Statement
  947.  
  948.         The command statement neither evaluates any expression nor
  949. saves any expression. It executes a command.
  950.  
  951. ----------------------------------------------------------------------
  952. Commands         Action
  953.  
  954. last             the last output.
  955. last[1]          the first element of the last output list.
  956. show_all         show all the variables in memory.
  957. clear(y)         clear the variable y from memory.
  958. clear_all        clear all the variables from memory.
  959. system(xx)       execute the MS-DOS command xx.
  960. end              the end of the program and library files.
  961. ---------------------------------------------------------------------
  962.  
  963.  
  964.                 9.6 Compound Statement
  965.  
  966.         The all above statements are simple statements. The compound
  967. statement specifies that its component statements are to be executed
  968. in the same sequence as they are written. They are separated by the
  969. separators (comma ","). e.g.
  970.                 a+b, 2+3
  971.  
  972.  
  973.                 9.7 End Statement
  974.  
  975.         Program must be terminated by the end statement. The end statement
  976. is "end" in a single last line.
  977.                 end
  978.  
  979.  
  980.             13. Library
  981.  
  982.         A library is a text file with a table of formula in
  983. mathematical notation, so users can edit them by any text (ASCII)
  984. editor. In order to expand the special ability of SymbMath, some
  985. libraries should be run. The library is loaded into the Editor by the 
  986. command "Load" in the "File" menu, and then run into memory. Many 
  987. libraries can be run into memory at a time, however, all names of the 
  988. variables are public and name conflicts must be avoided.
  989.         Users can clear all of them from memory by "clear_all". Note
  990. that the switch library "Switch.Li" should be run after clearing
  991. all from memory by "clear_all", otherwise the default switches may be
  992. changed.
  993.         Alternately, a part of the library file rather than the whole
  994. library file can be copied into the Editor by pressing <F7> (external 
  995. copy) and then run into memory in order to save memory.
  996.         There are many libraries. The following are some of them.
  997.  
  998.                 Table 13.1      Library
  999. ------------------------------------------------------------------------
  1000. File Name        Library Function
  1001.  
  1002. Switch.Li        switches on the default state.
  1003. Units.Li        an units conversion.
  1004. Function.Li        the user-defined functions.
  1005. Trig.Li            reduction of trig functions.
  1006. Hyerboli.Li        reduction of hyerbolic functions.
  1007. Integral.Li        integrals.
  1008. Derivati.Li        derivatives of special functions.
  1009. Diff.Li            to find total derivatives, and implicit 
  1010.             derivatives of an equation on one step.
  1011. Chemical.Li        the atomic weight of chemical elements.
  1012. Inorgani.Li        inorganic chemical reactions.
  1013. Organic.Li        organic chemical reactions.
  1014. -----------------------------------------------------------------------
  1015.  
  1016.  
  1017.                     (continued in SymbMath.DO2)